﻿using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;

public class UIRoom : MonoBehaviour
{
	public class RoomData
	{
		public string RoomName = "";
		public int RoomId = 0;
		public UInt32 PlayerCount = 0;
	}

	public RoomData InstData { get; set; }

	public Text TxRoomName, TxPlayerCount;

	// Use this for initialization
	void Start ()
	{

	}

	// Update is called once per frame
	void Update ()
	{
		UpdateUI();
	}

	void UpdateUI()
	{
		if (InstData == null)
			return;

		if (TxRoomName != null)	TxRoomName.text = InstData.RoomName;
		if (TxPlayerCount != null) TxPlayerCount.text = InstData.PlayerCount.ToString();
	}

	public void Enter()
	{
		if (InstData == null)
			return;

		UIRoomMgr.Instance.EnterRoom(InstData.RoomId);
	}
}

